package com.gitee.faster.webdav.kernel.model;

import com.gitee.faster.webdav.kernel.resource.Resource;
import jakarta.xml.bind.annotation.*;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Collections;
import java.util.List;

/**
 * @author hongda.li
 */
@Data
@Accessors(chain = true)
@SuppressWarnings("SpellCheckingInspection")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
        "content"
})
@XmlRootElement(name = "displayname")
public class DisplayName {

    @XmlMixed
    private List<String> content;

    public static DisplayName byName(Resource resource) {
        DisplayName displayName = new DisplayName();
        displayName.setContent(Collections.singletonList(resource.getName()));
        return displayName;
    }
}
